'use strict';

const path = require('path');
const os = require('os');
const logDir = path.join(os.homedir(), 'Desktop/docker_node_server/log');

const config = {
  db: {
    host: 'localhost',
    port: '27017',
    database: 'node_server',
  },
  redis: {
    host: "localhost",
    port: "6379"
  },
  path: {
    rsaPrivateKeyPath: path.join(__dirname, 'jwtRS256.key'),
    rsaPublicKeyPath: path.join(__dirname, 'jwtRS256.key.pub'),
    logDir: logDir,
    tmpUploadDir: path.join(os.homedir(), 'Desktop/docker_node_server/tmp'),    
    uploadDir: path.join(os.homedir(), 'Desktop/docker_node_server/files')
  },
  token: {
    expireTime: '7d',
  },
  captcha: {
    expireTime: 60 * 60,
  },
  log: {
    appenders: { 
      'all-console': { 
        type: 'console' 
      },
      'all-file': {
        type: 'dateFile',
        filename: `${logDir}/node-server-all.log`,
        compress: true
      },
      'error-file': {
        type: 'dateFile',
        filename: `${logDir}/node-server-error.log` ,
        compress: true
      },
      'error-file-filter': {
        type: 'logLevelFilter', 
        appender: 'error-file', 
        level: 'error'      
      }
    },
    categories: { 
      default: { 
        appenders: [
          'all-console', 
          'all-file', 
          'error-file-filter', 
        ], 
        level: 'debug' 
      } 
    }
  }
};

module.exports = config;

